home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-04-23 | 176.9 KB | 5,208 lines | [TEXT/????] |
- C======================================================================C
- C C
- C UIFLOW - 2 D C
- C ----------------- C
- C C
- C C
- C A computer program for TWO-dimensional analysis of C
- C turbulent elliptic flows in general coordinates. C
- C C
- C UIFLOW2D uses a decoupled multigrid procedure C
- C and solves for cell-centered velocities. C
- C C
- C Changes made to this code: C
- C ------------------------- C
- C C
- C (1) Inclusion of subroutine vset. C
- C (2) Specification of o2 mass fractions based on fuel fractions. C
- C (3) Error corrected in sub. gammod (-imaxl). C
- C (4) Adaptive cycle removed from sub. moment. C
- C (5) Correct placement of u and v residual calculations. C
- C C
- C======================================================================C
- SUBROUTINE UIFLOW
- include 'UIFlow.com'
- C
- CEXTERNAL SHOWLINE
- CEXTERNAL STOPKEY
- CEXTERNAL ABORTC
- INTEGER*2 STOPKEY
- CHARACTER*255 buffer
- CHARACTER*1 NULL
- C
- open(4, file='UIFlow.plt' ,access='sequential',status='unknown')
- open(5, file='UIFlow.In' ,access='sequential',status='unknown')
- open(8, file='UIFlow.out' ,access='sequential',status='unknown')
- open(11,file='UIFlow.Grid',access='sequential',status='unknown')
- C
- C.... Read input data and initialise flowfields
- C
- NULL = char(0)
- call SHOWLINE('Beginning Computation')
- call param
- call header
- call SHOWLINE('Reading Input File')
- call input
- if ( model .eq. 2 ) call search
- call outp
- call const
- if ( model .ne. 0 ) call constr
- call zero
- if ( kpgrid .eq. 1 ) call gridp
- if ( kpgrid .eq. 0 ) call grid
- call geomm
- call init
- C
- write (8,1001)
- write (8,1002)
- C
- C.... Set multigrid cycle
- C
- igrf = 1
- wrkunt = 0.0
- call SHOWLINE('Writing History')
- write (8, 1006) 'Convergence History'
- write (8, 1007)
- write (8, 1008) igrf
- write (8, 1013)
- write (8, 1005)
- C
- write (buffer, 2013) NULL
- call SHOWLINE(%ref(buffer))
- write (buffer, 2008) igrf, NULL
- call SHOWLINE(%ref(buffer))
- write (buffer, 2013) NULL
- call SHOWLINE(%ref(buffer))
- write (buffer, 2005) NULL
- call SHOWLINE(%ref(buffer))
- write (buffer, 3006) NULL
- call SHOWLINE(%ref(buffer))
- write (buffer, 3007) NULL
- call SHOWLINE(%ref(buffer))
- C
- xxx = 0
- 10 continue
- C
- nitn(igrf) = nitn(igrf) + 1
- if ( model .ne. 0 ) call lamvis(igrf)
- if ( klam .eq. 0 ) call tvis (igrf)
- C
- C.... Solve momentum and continuity equations
- C
- call moment(igrf)
- C
- C.... Solve scalar equations including k and epsilon
- C
- call scalrs(igrf)
- C
- C.... Update thermodynamic properties.
- C
- if ( (model .eq. 1) .or. (model .eq. 2) ) then
- call props (igrf)
- endif
- C
- C.... Enforce boundary conditions.
- C
- call extrpl(igrf)
- C
- C.... Check convergence on fine grid
- C
- write(8,1009) igrf, nitn(igrf), (error(igrf,nv), nv=3,8)
- write(buffer,2009) igrf, nitn(igrf), (error(igrf,nv),nv=3,8), NULL
- call SHOWLINE(%ref(buffer))
- xxx = STOPKEY()
- if (xxx .eq. 1) goto 9999
- C
- if ( error(igrf,3) .lt. tolr(igrf) ) goto 20
- if ( nitn(igrf) .ge. maxitn ) goto 9000
- if ( error(igrf,3) .gt. 1.0E+5 ) goto 9000
- go to 10
- C
- 20 continue
- write (8,1010) igrf
- write (8,1012)
- C
- write (buffer,2012) NULL
- call SHOWLINE(%ref(buffer))
- write (buffer,2010) igrf, NULL
- call SHOWLINE(%ref(buffer))
- write (buffer,2012) NULL
- call SHOWLINE(%ref(buffer))
- C
- C.... Terminate on finegrid or prolongate
- C
- if(igrf .eq. ngrid) go to 50
- C
- C.... Extrapolate Solution and increment grid
- C
- call prlong(igrf)
- igrf = igrf + 1
- call extrpl(igrf)
- write (8,1006) 'Convergence History Continued'
- write (8,1007)
- write (8,1008) igrf
- write (8,1013)
- write (8,1005)
- C
- write (buffer,2008) igrf, NULL
- call SHOWLINE(%ref(buffer))
- write (buffer,2013) NULL
- call SHOWLINE(%ref(buffer))
- write (buffer,2005) NULL
- call SHOWLINE(%ref(buffer))
- go to 10
- C
- 50 continue
- C
- C.... Converged on the desired finest grid
- C
- write (8,1015) 'The Problem Has Converged !!'
- write (8,1020)
- C
- write (buffer,2020) NULL
- call SHOWLINE(%ref(buffer))
- write (buffer,2015) 'The Problem Has Converged !! Wait For Final
- 1 Results to be Printed to Output File!', NULL
- call SHOWLINE(%ref(buffer))
- write (buffer,2020) NULL
- call SHOWLINE(%ref(buffer))
- go to 9001
- C
- 9000 continue
- write (8,1015) ' The Program is Not Converging Well,
- 1 Check The Input Data'
- C
- write (buffer,2015) ' The Program is Not Converging Well,
- 1 Check The Input Data', NULL
- call SHOWLINE(%ref(buffer))
- call ABORTC()
- goto 9999
- C
- 9001 continue
- call extrpl(ngrid)
- write (8,1006) 'Converged Flow Fields On Finest Grid'
- write (8,1007)
- C
- write (buffer,2007) NULL
- call SHOWLINE(%ref(buffer))
- write (buffer,2006) 'Converged Flow Fields On Finest Grid',NULL
- call SHOWLINE(%ref(buffer))
- write (buffer,2007) NULL
- call SHOWLINE(%ref(buffer))
- C
- call output(ngrid)
- call vset
- C call ftout (ngrid)
- C
- 990 format (5x,'Reading Input Data')
- 1001 format (72('*')/15x,'Initial Fields For Coarsest Grid')
- 1002 format (72('*'))
- 1005 format (/3x,'Grid',2x,'Iter',3x,'Mass',5x,8('-'),
- 1 'Norm. Residuals in Scalars ',8('-')/3x,'Numb',
- 2 2x,'Numb',3x,'Residual',3x,'Swirl',4x,'Enthalpy',4x,
- 3 'k',4x,'eps',4x,'Mix. Fraction'/3x,'----',2x,'----',3x,
- 4 8('-'),3x,5('-'),4x,8('-'),2(3x,3('-')),4x,13('-'))
- 2005 format (3x,'Grid',2x,'Iter',3x,'Mass',5x,8('-'),
- 1 'Norm. Residuals in Scalars ',8('-'),a1)
- 3006 format (3x,'Numb',2x,'Numb',3x,'Residual',3x,'Swirl',4x,'Enthalpy',
- 1 4x,'k',4x,'eps',4x,'Mix. Fraction',a1)
- 3007 format (3x,'----',2x,'----',3x,8('-'),3x,5('-'),4x,8('-'),
- 1 2(3x,3('-')),4x,13('-'),a1)
- 1006 format (/72('*')/25x,72a)
- 2006 format (25x,72a,1a)
- 1007 format (72('*'))
- 2007 format (5x,72('*'),1a)
- 1008 format (72('-')/15x,'Starting Grid Number',i5)
- 2008 format (15x,'Starting Grid Number',i5,a1)
- 1009 format (5x,i2,3x,i4,3x,6(1pe12.5,1x))
- 2009 format (5x,i2,3x,i4,3x,6(1pe12.5,1x),a1)
- 1010 format (/5x,30('+')/6x,'Converged on Grid Number',i4)
- 2010 format (6x,'Converged on Grid Number',i4,a1)
- 1012 format (5x,30('+'))
- 2012 format (5x,30('+'),a1)
- 1013 format (72('-'))
- 2013 format (72('-'),a1)
- 1015 format (/5x,81('*')/5x,81a)
- 2015 format (5x,81a,a1)
- 1020 format (5x,81('*'))
- 2020 format (5x,81('*'),a1)
- 1028 format(i4,a1,1pe10.3)
- C
- 9999 continue
- close(UNIT = 4, status='keep')
- close(UNIT = 5, status='keep')
- close(UNIT = 8, status='keep')
- close(UNIT = 11,status='keep')
- C
- return
- end
- C======================================================================C
- subroutine adjstx (igrl)
- C C
- C Purpose: Perform integral mass adjustments to satisfy overall C
- C mass balance at every zi station. C
- C C
- C======================================================================C
- include 'UIFlow.com'
- include 'UIFlow.indx'
- C
- delp = 0.0
- sumin = 0.0
- C
- do 10 j = 2, jmax1
- ij = 1 + (j-1) * imaxl + ibeg
- sumin = sumin + cx(ij)
- 10 continue
- C
- do 30 i = 2, imax2
- ijf = i + ibeg
- ijl = i + (jmax1-1) * imaxl + ibeg
- sumin = sumin + cy(ijf) - cy(ijl)
- C
- C.... Calculate actual mass flow rate.
- C
- sumflx = 0.0
- sumcf = 0.0
- C
- do 20 j = 2, jmax1
- ij = i + (j-1) * imaxl + ibeg
- sumflx = sumflx + cx(ij)
- sumcf = sumcf + ae(ij)
- 20 continue
- if (i .eq. imax1) sumcf = 1.0
- C
- C.... Scale fluxes to satisfy mass continuity, and change pressure to
- C correspond to change in mass flux.
- C
- delp = delp + (sumin - sumflx) / sumcf
- if (i .eq. imax1) delp = 0.0
- do 25 j = 2, jmax1
- ij = i + (j-1) * imaxl + ibeg
- cx(ij) = cx (ij) * sumin / sumflx
- cu(ij) = cu (ij) * sumin / sumflx
- p(ij+1) = p(ij+1) - delp
- 25 continue
- 30 continue
- C
- return
- end
- C======================================================================C
- subroutine apcalc (igrl)
- C C
- C Purpose: Calculate apu and apv for use in computing C
- C the mass fluxes. C
- C C
- C======================================================================C
- include 'UIFlow.com'
- include 'UIFlow.indx'
- C
- do 11 j = 2, jmax1
- ioff = (j-1) * imaxl + ibeg
- do 10 i = 2, imax1
- ij = i + ioff
- ijp1 = ij + 1
- ijm1 = ij - 1
- ijp = ij + imaxl
- ijm = ij - imaxl
- apu(ij) = (ae(ij) * u(ijp1) + aw(ij) * u(ijm1) +
- 1 an(ij) * u(ijp) + as(ij) * u(ijm) +
- 2 apu(ij) ) / app(ij)
- apv(ij) = (ae(ij) * v(ijp1) + aw(ij) * v(ijm1) +
- 1 an(ij) * v(ijp) + as(ij) * v(ijm) +
- 2 apv(ij) ) / ap(ij)
- apm(ij) = ap(ij)
- 10 continue
- 11 continue
- C
- return
- end
- C======================================================================C
- subroutine bbndry
- C C
- C Purpose: Prescribe boundary conditions on the eta minus C
- C (bottom) boundary of the calculation domain. C
- C C
- C======================================================================C
- include 'UIFlow.com'
- igrl = ngrid
- include 'UIFlow.indx'
- C
- j = 1
- do 12 n = 1, nsym
- C
- if (model .eq. 0) rhym(n) = rhgs
- if (model .eq. 1) rhym(n) = pref * wmair / (gascon * tym(n))
- if (model .eq. 2) then
- yn2ym = 1.0 - fuym(n) - o2ym(n) - h2oym(n) - co2ym(n)
- rwmym = fuym(n)/wmfu + o2ym(n)/wmox + yn2ym/wmn2
- 1 + co2ym(n)/wmco2 + h2oym(n)/wmh2o
- wmym(n) = 1.0 / rwmym
- rhym(n) = pref * wmym(n) / (gascon * tym(n))
- endif
- C
- ifl = ifym (n,ngrid)
- ill = ilym (n,ngrid)
- do 10 i = ifl, ill
- ijf = i + (j-1) * imaxl + ibeg
- u (ijf) = ubym(n)
- v (ijf) = vbym(n)
- w (ijf) = wbym(n)
- p (ijf) = 0.0
- t (ijf) = tym (n)
- tke (ijf) = tkym(n)
- tde (ijf) = tdym(n)
- f (ijf) = fym(n)
- g (ijf) = gym(n)
- yfu (ijf) = fuym(n)
- yo2 (ijf) = o2ym(n)
- yh2o(ijf) = h2oym(n)
- yco2(ijf) = co2ym(n)
- yn2 (ijf) = yn2ym
- gam (ijf) = vscty
- amu (ijf) = vscty
- amut(ijf) = cd * rhym(n) * tkym(n) * tkym(n) /
- 1 ( tdym(n) + 1.0e-30 )
- wmol(ijf) = wmym(n)
- rho (ijf) = rhym(n)
- cv (ijf) = a21(ijf)*u(ijf) + a22(ijf)*v(ijf)
- cy (ijf) = cv (ijf)*rho(ijf)
- 10 continue
- 12 continue
- return
- end
- C======================================================================C
- subroutine bcor (igrl, q1)
- C C
- C Purpose: Extrapolate interior values of the given quantity to C
- C the wall. Consistent with enforcing a zero normal C
- C derivative of the given variable. C
- C C
- C======================================================================C
- include 'UIFlow.com'
- dimension q1(*)
- include 'UIFlow.indx'
- C
- do 10 j = 1, jmaxl
- ijf = (j-1) * imaxl + ibeg
- q1(ijf + 1) = q1 (ijf + 2)
- q1(ijf+imaxl) = q1 (ijf+imax1)
- 10 continue
- C
- do 20 i = 1, imaxl
- ijf = i + ibeg
- ij1 = ijf + jmax1 * imaxl
- q1(ijf) = q1 (ijf+imaxl)
- q1(ij1) = q1 (ij1 - imaxl)
- 20 continue
- C
- return
- end
- C======================================================================C
- block data param
- C======================================================================C
- include 'UIFlow.com'
- data cd, cdqtr, cdtqtr, ee, ak/ 0.09,0.5477,0.1643,9.025,0.4/
- data ce1, ce2, cg1, cg2, cr/ 1.44, 1.92, 2.8, 2.0, 3.0/
- data acpox, bcpox, ccpox/938.5681,0.0972,-1.7167e-5/
- data acpn2, bcpn2, ccpn2/842.5130,0.2364,-6.1891e-5/
- data acpco2,bcpco2,ccpco2/842.7291,0.2927,-7.8040e-5/
- data acph2o,bcph2o,ccph2o/1215.6587,0.7182,-1.3888e-4/
- data acpfu, bcpfu, ccpfu/1420.5564,1.7792,-3.9418e-4/
- data wmh2o, wmco2/ 18.01520, 44.00980/
- data wmn2, wmox/ 28.161 , 31.99880/
- data hox , hn2 / 2.8802e5, 2.7057e5 /
- data hco2, hh2o/ 2.7521e5, 4.2261e5 /
- data rox, wmair, gascon/0.2331, 28.967, 8314.3/
- data airt, airv, airs, airsum/273.11, 1.716e-5, 110.56, 383.67/
- data hfu, wmfu /5.7125e5, 44.09620/
- data hffu, hfco2, hfh2o / -2.35510e6, -8.94114e6, -1.34228e7/
- data gamma/ 1.40 /
- data acpair, bcpair, ccpair/868.3073, 0.2054, -51.846e-6/
- data grav, kgrav/9.80665,0/
- data beta, rdfctr/0.85, 0.1/
- data bta/0.1024/
- data refu, refv, refw, refc/1.0,1.0,1.0,1.0/
- data nitr/1,1,1,1,1/
- data tolr/0.01,0.001,0.01,0.01,0.01/
- data nitke/3/
- data knorth/0/
- data ind1,ind2,ind3,ind4/1,1,1,1/
- data alft, alfrho/0.95,0.95/
- end
- C======================================================================C
- subroutine cflux (igrl)
- C C
- C Purpose: Calculate values of the mass fluxes and contravariant C
- C velocities at the cell faces. C
- C C
- C======================================================================C
- include 'UIFlow.com'
- include 'UIFlow.indx'
- C
- C.... Calculate flux perpendicular to eta coordinate.
- C
- call grad (igrl, p)
- relxm = 1.0 - relx(1)
- C
- do 11 j = 2, jmax1
- ioff = (j-1) * imaxl + ibeg
- do 10 i = 2, imax2
- ij = i + ioff
- ij1 = ij + 1
- cu(ij) = a11(ij) *
- 1 ( fx (ij) * ( apu(ij1)+duy(ij1)*dpdy(ij1)/app(ij1) )
- 2 + fx1(ij) * ( apu(ij) +duy(ij) *dpdy(ij) /app(ij) ) )
- 3 + a12(ij) *
- 4 ( fx (ij) * ( apv(ij1)+dvy(ij1)*dpdy(ij1)/ap(ij1))
- 5 + fx1(ij) * ( apv(ij) +dvy(ij) *dpdy(ij) /ap(ij) ) )
- 6 + ( a11(ij)*a11(ij)*(fx(ij)/app(ij1) + fx1(ij)/app(ij))
- 7 + a12(ij)*a12(ij)*(fx(ij)/ap(ij1) + fx1(ij)/ap(ij)))
- 8 * ( p(ij) - p(ij1) ) + relxm * cu(ij)
- cx(ij) = cu(ij) * ( amax1( sign( rho(ij) , cu(ij) ), 0.)
- 1 + amax1( sign( rho(ij1), -cu(ij) ), 0.) )
- 10 continue
- 11 continue
- C
- C.... Calculate flux perpendicular to zi coordinate.
- C
- do 21 j = 2, jmax2
- ioff = (j-1) * imaxl + ibeg
- ioffp = ioff + imaxl
- do 20 i = 2, imax1
- ij = i + ioff
- ijp = i + ioffp
- cv(ij) = a21(ij) *
- 1 ( fy (ij) * ( apu(ijp) + dux(ijp)*dpdx(ijp)/app(ijp) )
- 2 + fy1(ij) * ( apu(ij) + dux(ij) *dpdx(ij) /app(ij)) )
- 3 + a22(ij) *
- 4 ( fy(ij) * ( apv(ijp) + dvx(ijp)*dpdx(ijp)/ap(ijp) )
- 5 + fy1(ij) * ( apv(ij) + dvx(ij) *dpdx(ij) /ap(ij) ) )
- 6 + ( a21(ij)*a21(ij)*(fy(ij)/app(ijp) + fy1(ij)/app(ij))
- 7 + a22(ij)*a22(ij)*(fy(ij)/ap(ijp) + fy1(ij)/ap(ij)))
- 8 * ( p(ij) - p(ijp) ) + relxm * cv(ij)
- cy(ij) = cv(ij) * ( amax1( sign( rho(ij) , cv(ij) ), 0.)
- 1 + amax1( sign( rho(ijp), -cv(ij) ), 0.) )
- 20 continue
- 21 continue
- return
- end
- C======================================================================C
- subroutine cfluxc (igrl)
- C C
- C Purpose: Make corrections to contravariant velocities and mass C
- C fluxes. For use when iterations are being performed C
- C on the coarse grids. C
- C C
- C======================================================================C
- include 'UIFlow.com'
- C
- imaxc = imax(igrl)
- jmaxc = jmax(igrl)
- imaxf = imax(igrl+1)
- jmaxf = jmax(igrl+1)
- imaxc1 = imaxc - 1
- jmaxc1 = jmaxc - 1
- imaxc2 = imaxc - 2
- jmaxc2 = jmaxc - 2
- ibegc = nbeg(igrl)
- C
- do 6 jc = 1, jmaxc
- do 5 ic = 1, imaxc
- ijc = ic + (jc-1) * imaxc + ibegc
- dx(ijc) = 0.0
- dy(ijc) = 0.0
- x3(ijc) = 0.0
- su(ijc) = 0.0
- 5 continue
- 6 continue
- C
- C.... Evaluate corrections to finer grid.
- C
- do 11 jc = 2, jmaxc1
- do 10 ic = 2, imaxc1
- ijc = ic + (jc - 1) * imaxc + ibegc
- ijf = iru (ijc)
- ijf1 = ijf - 1
- ijfm = ijf - imaxf
- ijfm1 = ijf - imaxf - 1
- apm(ijc) = ap(ijc)
- dx(ijc) = u(ijc) - 0.25 * (u(ijf) + u(ijf1) + u(ijfm) +
- 1 u(ijfm1))
- dy(ijc) = v(ijc) - 0.25 * (v(ijf) + v(ijf1) + v(ijfm) +
- 1 v(ijfm1))
- x3(ijc) = p(ijc) - 0.25 * (p(ijf) + p(ijf1) + p(ijfm) +
- 1 p(ijfm1))
- 10 continue
- 11 continue
- C
- call bcor (igrl, x3)
- C
- call trsrc (igrl, dx)
- C
- do 21 j = 2, jmaxc1
- ioff = (j-1) * imaxc + ibegc
- do 20 i = 2, imaxc1
- ij = i + ioff
- apu(ij) = (ae(ij) * dx(ij+1) + aw(ij) * dx(ij-1) +
- 1 an(ij) * dx(ij+imaxc) + as(ij) * dx(ij-imaxc)
- 2 + resux(ij) + su(ij))/app(ij)
- 20 continue
- 21 continue
- C
- call trsrc (igrl, dy)
- C
- do 23 j = 2, jmaxc1
- ioff = (j-1) * imaxc + ibegc
- do 22 i = 2, imaxc1
- ij = i + ioff
- apv(ij) = (ae(ij) * dy(ij+1) + aw(ij) * dy(ij-1) +
- 1 an(ij) * dy(ij+imaxc) + as(ij) * dy(ij-imaxc)
- 2 + resvx(ij) + su(ij))/ap(ij)
- 22 continue
- 23 continue
- C
- C.... Restrict fluxes again from fine grid.
- C
- call restfl (igrl+1)
- call grad (igrl, x3)
- C
- do 31 j = 2, jmaxc1
- ioff = (j-1) * imaxc + ibegc
- ioffp = ioff + 1
- do 30 i = 2, imaxc2
- ij = i + ioff
- ij1 = i + ioffp
- cu(ij) = a11(ij) *
- 1 ( fx (ij) * ( apu(ij1)+duy(ij1)*dpdy(ij1)/app(ij1) )
- 2 + fx1(ij) * ( apu(ij) +duy(ij) *dpdy(ij) /app(ij) ) )
- 3 + a12(ij) *
- 4 ( fx (ij) * ( apv(ij1)+dvy(ij1)*dpdy(ij1)/ap(ij1))
- 5 + fx1(ij) * ( apv(ij) +dvy(ij) *dpdy(ij) /ap(ij) ) )
- 6 + ( a11(ij)*a11(ij)*(fx(ij)/app(ij1) + fx1(ij)/app(ij))
- 7 + a12(ij)*a12(ij)*(fx(ij)/ap(ij1) + fx1(ij)/ap(ij)))
- 8 * ( x3(ij) - x3(ij1) ) + cu(ij)
- cx(ij) = cu(ij) * (amax1 (sign (rho(ij) , cx(ij)), 0.0)
- 1 + amax1 (sign (rho(ij1), -cx(ij)), 0.0))
- 30 continue
- 31 continue
- C
- do 41 j = 2, jmaxc2
- ioff = (j-1) * imaxc + ibegc
- ioffp = ioff + imaxc
- do 40 i = 2, imaxc1
- ij = i + ioff
- ijp = i + ioffp
- cv(ij) = a21(ij) *
- 1 ( fy (ij) * ( apu(ijp) + dux(ijp)*dpdx(ijp)/app(ijp) )
- 2 + fy1(ij) * ( apu(ij) + dux(ij) *dpdx(ij) /app(ij)) )
- 3 + a22(ij) *
- 4 ( fy(ij) * ( apv(ijp) + dvx(ijp)*dpdx(ijp)/ap(ijp) )
- 5 + fy1(ij) * ( apv(ij) + dvx(ij) *dpdx(ij) /ap(ij) ) )
- 6 + ( a21(ij)*a21(ij)*(fy(ij)/app(ijp) + fy1(ij)/app(ij))
- 7 + a22(ij)*a22(ij)*(fy(ij)/ap(ijp) + fy1(ij)/ap(ij)))
- 8 * ( x3(ij) - x3(ijp) ) + cv(ij)
- cy(ij) = cv(ij) * (amax1 (sign (rho(ij) , cy(ij)), 0.0)
- 1 + amax1 (sign (rho(ijp), - cy(ij)), 0.0))
- 40 continue
- 41 continue
- return
- end
- C======================================================================C
- subroutine cfpmod (igrl)
- C C
- C Purpose: Modify coefficients of the pressure correction C
- C equation to account for boundary condition. C
- C C
- C======================================================================C
- include 'UIFlow.com'
- include 'UIFlow.indx'
- C
- if (kcomp .eq. 1) call pcoefc (igrl)
- C
- do 10 j = 2, jmax1
- ioff = (j-1) * imaxl + ibeg
- ij1 = ioff + 2
- ij2 = ioff + imax1
- ap(ij1) = ap(ij1) - aw(ij1)
- ap(ij2) = ap(ij2) - ae(ij2)
- aw(ij1) = 0.0
- ae(ij2) = 0.0
- dx(ij2) = 0.0
- 10 continue
- C
- do 20 i = 2, imax1
- ioff = i + ibeg
- ij1 = ioff + imaxl
- ij2 = ioff + (jmax1-1) * imaxl
- ap(ij1) = ap(ij1) - as(ij1)
- ap(ij2) = ap(ij2) - an(ij2)
- as(ij1) = 0.0
- an(ij2) = 0.0
- dy(ij2) = 0.0
- 20 continue
- C
- return
- end
- C======================================================================C
- subroutine coeff(igrl)
- C C
- C Purpose: Calculate coefficients of the discretized equation C
- C for any flow variable. The hybrid discretization C
- C scheme is presently being used. C
- C C
- C======================================================================C
- include 'UIFlow.com'
- include 'UIFlow.indx'
- C
- do 11 j = 2, jmax1
- ioff = (j-1) * imaxl + ibeg
- ioff1 = ioff - 1
- ioffm = ioff - imaxl
- do 10 i = 2, imax1
- ij = i + ioff
- ij1 = i + ioff1
- ijm = i + ioffm
- ae(ij) = amax1( 0., -cx(ij) , -cx(ij) * fx (ij) + dx(ij) )
- aw(ij) = amax1( 0., cx(ij1), cx(ij1) * fx1(ij1) + dx(ij1) )
- an(ij) = amax1( 0., -cy(ij) , -cy(ij) * fy (ij) + dy(ij) )
- as(ij) = amax1( 0., cy(ijm), cy(ijm) * fy1(ijm) + dy(ijm) )
- 10 continue
- 11 continue
- C
- return
- end
- C======================================================================C
- subroutine coeffp (igrl)
- C C
- C Purpose: Calculate coefficients of the pressure correction C
- C equation. C
- C C
- C======================================================================C
- include 'UIFlow.com'
- include 'UIFlow.indx'
- C
- do 11 j = 2, jmax1
- ioff = (j-1) * imaxl + ibeg
- ioff1 = ioff + 1
- ioffp = ioff + imaxl
- do 10 i = 2, imax1
- ij = i + ioff
- ij1 = i + ioff1
- ijp = i + ioffp
- ae(ij) = ( a11(ij) * a11(ij) + a12(ij) * a12(ij) )
- 1 * ( fx(ij) / apm(ij1) + fx1(ij) / apm(ij) )
- ae(ij) = ae(ij) * ( amax1( sign( rho(ij) , cx(ij) ), 0.)
- 1 + amax1( sign( rho(ij1), -cx(ij) ), 0.) )
- dx(ij) = ae(ij)
- an(ij) = ( a21(ij) * a21(ij) + a22(ij) * a22(ij) )
- 1 * ( fy(ij) / apm(ijp) + fy1(ij) / apm(ij) )
- an(ij) = an(ij) * ( amax1( sign( rho(ij) , cy(ij) ), 0.)
- 1 + amax1( sign( rho(ijp), -cy(ij) ), 0.) )
- dy(ij) = an(ij)
- 10 continue
- 11 continue
- C
- return
- end
- C======================================================================C
- subroutine const
- C C
- C Purpose: Compute indices on coarse grids. C
- C C
- C======================================================================C
- include 'UIFlow.com'
- C
- imax(ngrid) = ncelx + 2
- jmax(ngrid) = ncely + 2
- nbeg (1) = 0
- if( ngrid .eq. 1 ) return
- C
- ngrid1 = ngrid - 1
- do 10 nr = 1, ngrid1
- n = ngrid - nr
- imax(n) = ncelx / (2 ** nr) + 2
- jmax(n) = ncely / (2 ** nr) + 2
- 10 continue
- C
- do 15 n = 2, ngrid
- nbeg(n) = nbeg(n-1) + imax(n-1)*jmax(n-1)
- 15 continue
- C
- C.... Indices for prolongation.
- C
- do 25 igr = 1, ngrid1
- imaxc = imax (igr)
- jmaxc = jmax (igr)
- ibegc = nbeg (igr)
- imaxf = imax(igr+1)
- jmaxf = jmax(igr+1)
- ibegf = nbeg(igr+1)
- do 18 j = 1, jmaxc
- do 18 i = 1, imaxc
- ijc = i + (j-1) * imaxc + ibegc
- ijf = 2*i-1 + (2*j-2)*imaxf + ibegf
- iru(ijc) = ijf
- 18 continue
- C
- C.... Modify at boundaries.
- C
- j = jmaxc
- do 20 i = 2, imaxc-1
- ijc = i + (j-1) * imaxc + ibegc
- ijf = 2*i-1 + (2*j-3)*imaxf + ibegf
- iru(ijc) = ijf
- 20 continue
- i = imaxc
- do 21 j = 2, jmaxc-1
- ijc = i + (j-1) * imaxc + ibegc
- ijf = 2*(i-1) + (2*j-2)*imaxf + ibegf
- iru(ijc) = ijf
- 21 continue
- 25 continue
- C
- C.... Restrict segment indices.
- C
- do 40 nr = 1, ngrid1
- n = ngrid - nr
- C
- do 31 i = 1, nsxm
- jfxm(i,n) = (jfxm (i,n+1)-2)/2 + 2
- jlxm(i,n) = (jlxm (i,n+1)-1)/2 + 1
- 31 continue
- C
- do 32 i = 1, nsxp
- jfxp(i,n) = (jfxp (i,n+1)-2)/2 + 2
- jlxp(i,n) = (jlxp (i,n+1)-1)/2 + 1
- 32 continue
- C
- do 33 i = 1, nsym
- ifym(i,n) = (ifym (i,n+1)-2)/2 + 2
- ilym(i,n) = (ilym (i,n+1)-1)/2 + 1
- 33 continue
- C
- do 34 i = 1, nsyp
- ifyp(i,n) = (ifyp (i,n+1)-2)/2 + 2
- ilyp(i,n) = (ilyp (i,n+1)-1)/2 + 1
- 34 continue
- C
- 40 continue
- C
- return
- end
- C======================================================================C
- subroutine constr
- C C
- C Purpose: Compute the constants required for the combustion C
- C models. C
- C C
- C======================================================================C
- include 'UIFlow.com'
- C
- C.... Values for PROPANE ( C3H8 ).
- C
- if ( kfuel .eq. 0 ) then
- wmfu = 44.0962
- wmpr = 28.3238
- hreact = 46.353e6
- stoic = 15.5715
- tstoic = 2396.0
- acpfu = 1420.56
- bcpfu = 1.7792
- ccpfu = -3.94184e-4
- acpprd = 882.544
- bcpprd = 1.0537
- ccpprd = -2.22175e-4
- cxx = 3.0
- hyy = 8.0
- aa(1) = 0.10
- bb(1) = 1.65
- acten(1) = 30000.0
- prexp(1) = 8.6e11
- endif
- C
- C.... Values for METHANE ( CH4 ).
- C
- if ( kfuel .eq. 1 ) then
- wmfu = 16.04260
- wmpr = 27.6339
- hreact = 44.164e6
- stoic = 17.1206
- tstoic = 2329.0
- acpfu = 1126.59
- bcpfu = 2.3305
- ccpfu = -481.2e-6
- acpprd = 891.9962
- bcpprd = 0.3055
- ccpprd = -74.111e-6
- cxx = 1.0
- hyy = 4.0
- aa(1) = -0.3
- bb(1) = 1.3
- acten(1) = 48400
- prexp(1) = 1.3e8
- endif
- C
- C.... Values for TOWN GAS ( mixture of methane and ethane ).
- C
- if ( kfuel .eq. 2 ) then
- wmfu = 18.4349
- wmpr = 27.7509
- hreact = 37.0227e6
- stoic = 14.376
- tstoic = 2510.0
- acpfu = 1066.49
- bcpfu = 1.9408
- ccpfu = -403.83e-6
- acpprd = 888.335
- bcpprd = 0.3022
- ccpprd = -73.406e-6
- cxx = 1.0
- hyy = 4.0
- aa(1) = -0.3
- bb(1) = 1.3
- acten(1) = 48400
- prexp(1) = 1.3e8
- endif
- C
- C.... Calculate constants used for diffusion flame model.
- C
- fstoic = 1.0 / ( 1.0 + stoic )
- rstoic = pref * wmpr / gascon / tstoic
- ysub = 1.0 / ( 1.0 - fstoic )
- rfuel = pref * wmfu / gascon / tfuel
- rair = pref * wmair / gascon / tair
- denom = fstoic * ( 1.0 - fstoic )
- tprd = alft * ( tstoic - ( (1.0 - fstoic) * tair
- 1 + fstoic * tfuel ) ) / denom
- rprd = alfrho * ( rstoic - ( (1.0 - fstoic) * rair
- 1 + fstoic * rfuel ) ) / denom
- phia = - 1.0 / stoic
- phifma = 1.0 + ( 1.0 / stoic )
- C
- cpf = acpfu + bcpfu * tfuel + ccpfu * tfuel * tfuel
- cpa = acpair + bcpair * tair + ccpair * tair * tair
- enthfu = cpf * tfuel + hreact
- enthox = cpa * tair
- C
- C.... Calculate constants used for premixed flame model.
- C
- rat(1) = cxx * wmco2 / wmfu
- rat(2) = ( hyy * wmh2o ) / ( 2.0 * wmfu )
- rat(3) = cxx * wmox / wmfu + ( hyy * wmox ) / ( 4.0 * wmfu )
- rat(4) = 3.0 * wmco2 / wmfu
- rat(5) = 4.0 * wmh2o / wmfu
- C
- ab(1) = aa(1) + bb(1)
- prexp(1) = 1000.0 * wmfu * prexp(1) * ( 0.001 )**ab(1)
- 1 * ( 1.0 / wmfu )**aa(1) * ( 1.0 / wmox )**bb(1)
- acten(1) = acten(1) * 4.1868 / 8.3143
- C
- C....Ensure that initial estimate of mixture fraction is LARGER than
- C the fuel mass fraction.
- C
- if ( fugs .gt. fgs ) then
- temp = fgs
- fgs = fugs
- fugs = temp
- endif
- C
- C....Specify initial estimates of mass fractions based on the given
- C estimates of mixture fraction and fuel mass fraction.
- C
- o2gs = rox * ( 1.0 - fgs ) - rat(3) * ( fgs - fugs )
- co2gs = rat(1) * ( fgs - fugs )
- h2ogs = rat(2) * ( fgs - fugs )
- C
- return
- end
- C======================================================================C
- subroutine cpenth (igrl)
- C C
- C Purpose: Calculate the specific heat appropriate for C
- C determination of the fluid temperature. C
- C C
- C======================================================================C
- include 'UIFlow.com'
- include 'UIFlow.indx'
- C
- C.... Cp for air only.
- C
- if (model .eq. 1) then
- do 11 j = 1, jmaxl
- ioff = (j-1) * imaxl + ibeg
- do 10 i = 1, imaxl
- ij = i + ioff
- cph(ij) = acpair + bcpair * t(ij) + ccpair * t(ij) * t(ij)
- 10 continue
- 11 continue
- C
- elseif (model .eq. 2) then
- C
- C.... Cp for mixture of fuel and air.
- C
- do 21 j = 1, jmaxl
- ioff = (j-1) * imaxl + ibeg
- do 20 i = 1, imaxl
- ij = i + ioff
- cpfu = acpfu + bcpfu * t(ij) + ccpfu * t(ij) * t(ij)
- cpox = acpox + bcpox * t(ij) + ccpox * t(ij) * t(ij)
- cpn2 = acpn2 + bcpn2 * t(ij) + ccpn2 * t(ij) * t(ij)
- cpco2 = acpco2 + bcpco2 * t(ij) + ccpco2 * t(ij) * t(ij)
- cph2o = acph2o + bcph2o * t(ij) + ccph2o * t(ij) * t(ij)
- cph(ij) = yfu(ij) * cpfu + yo2(ij) * cpox
- 1 + yn2(ij) * cpn2 + yco2(ij) * cpco2
- 2 + yh2o(ij)* cph2o
- 20 continue
- 21 continue
- endif
- C
- return
- end
- C======================================================================C
- subroutine cpgrad (igrl)
- C C
- C Purpose: Compute the cross derivative terms in the pressure C
- C correction equation. C
- C C
- C======================================================================C
- include 'UIFlow.com'
- include 'UIFlow.indx'
- C
- do 6 j = 1, jmaxl
- ioff = (j-1) * imaxl + ibeg
- do 5 i = 1, imaxl
- ij = i + ioff
- x1(ij) = 0.0
- x2(ij) = 0.0
- 5 continue
- 6 continue
- C
- do 11 j = 2, jmax1
- ioff = (j-1) * imaxl + ibeg
- ioffp = ioff + 1
- do 10 i = 2, imax2
- ij = i + ioff
- ij1 = i + ioffp
- x1(ij) = a11(ij) * (fx(ij) * duy(ij1) * dpdy(ij1)/apm(ij1) +
- 1 fx1(ij)* duy(ij) * dpdy(ij) /apm(ij)) +
- 2 a12(ij) * (fx(ij) * dvy(ij1) * dpdy(ij1)/apm(ij1) +
- 3 fx1(ij)* dvy(ij) * dpdy(ij) /apm(ij))
- 10 continue
- 11 continue
- C
- do 21 j = 2, jmax2
- ioff = (j-1) * imaxl + ibeg
- ioffp = ioff + imaxl
- do 20 i = 2, imax1
- ij = i + ioff
- ijp = i + ioffp
- x2(ij) = a21(ij) * (fy(ij) * dux(ijp) * dpdx(ijp)/apm(ijp) +
- 1 fy1(ij)* dux(ij) * dpdx(ij) /apm(ij)) +
- 4 a22(ij) * (fy(ij) * dvx(ijp) * dpdx(ijp)/apm(ijp) +
- 5 fy1(ij)* dvx(ij) * dpdx(ij) /apm(ij))
- 20 continue
- 21 continue
- C
- return
- end
- C======================================================================C
- subroutine dens (igrl)
- C C
- C Purpose: Calculate the fluid density based on the assumption C
- C of ideal gas behavior. Allocation is also made for C
- C low mach number flames in which the base pressure of C
- C the system determines the thermodynamic state. C
- C C
- C======================================================================C
- include 'UIFlow.com'
- include 'UIFlow.indx'
- C
- relxm = 1.0 - relx(11)
- C
- if ( kcomp .eq. 0 ) then
- C
- C.... Low mach number case ( Charles' law is applicable ).
- C
- do 11 j = 2, jmax1
- ioff = (j-1) * imaxl + ibeg
- do 10 i = 2, imax1
- ij = i + ioff
- rhl = pref * wmol(ij) / ( gascon * t(ij) )
- rho(ij) = relx(11) * rhl + relxm * rho(ij)
- 10 continue
- 11 continue
- C
- elseif ( kcomp .eq. 1 ) then
- C
- C.... Density determination for a compressible flow.
- C
- do 21 j = 2, jmax1
- ioff = (j-1) * imaxl + ibeg
- do 20 i = 2, imax1
- ij = i + ioff
- rhl = (p(ij) + pref) * wmol(ij) / ( gascon * t(ij) )
- rho(ij) = relx(11) * rhl + relxm * rho(ij)
- 20 continue
- 21 continue
- endif
- C
- return
- end
- C======================================================================C
- subroutine dflux (igrl)
- C C
- C Purpose: Compute the diffusion contributions to the C
- C coefficients in the discretized equations. C
- C C
- C======================================================================C
- include 'UIFlow.com'
- include 'UIFlow.indx'
- C
- do 11 j = 1, jmax1
- ioff = (j-1) * imaxl + ibeg
- ioffp = ioff + imaxl
- do 10 i = 1, imax1
- ij = i + ioff
- ijp = i + ioffp
- dx(ij) = (fx(ij) * gam(ij+1) + fx1(ij) * gam(ij)) * q11(ij)
- dy(ij) = (fy(ij) * gam(ijp) + fy1(ij) * gam(ij)) * q22(ij)
- 10 continue
- 11 continue
- C
- return
- end
- C======================================================================C
- subroutine enth (igrl)
- C C
- C Purpose: Calculate initial sensible enthalpy field. C
- C C
- C======================================================================C
- include 'UIFlow.com'
- include 'UIFlow.indx'
- C
- if (model .eq. 1) then
- C
- C.... For air only.
- C
- hmix = rox * hox + (1.0 - rox) * hn2
- C
- do 11 j = 1, jmaxl
- ioff = (j-1) * imaxl + ibeg
- do 10 i = 1, imaxl
- ij = i + ioff
- h(ij) = cph(ij) * t(ij) - hmix
- 10 continue
- 11 continue
- C
- elseif (model .eq. 2) then
- C
- C.... For constituents of the one step chemical reaction.
- C
- do 21 j = 1, jmaxl
- ioff = (j-1) * imaxl + ibeg
- do 20 i = 1, imaxl
- ij = i + ioff
- hmix = yfu(ij) * hfu + yo2(ij) * hox
- 1 + yn2(ij) * hn2 + yco2(ij) * hco2
- 2 + yh2o(ij) * hh2o
- h(ij) = cph(ij) * t(ij) - hmix
- 20 continue
- 21 continue
- endif
- C
- return
- end
- C======================================================================C
- subroutine extrpl(igrl)
- C C
- C Purpose: Enforce boundary conditions by extrapolating interior C
- C values. C
- C C
- C======================================================================C
- include 'UIFlow.com'
- C
- call xmextr (igrl)
- call xpextr (igrl)
- call ymextr (igrl)
- call ypextr (igrl)
- if ( kadj .eq. 0 ) call mssout (igrl)
- C
- return
- end
- C======================================================================C
- subroutine fstchm (igrl)
- C C
- C Purpose: Calculate quantities pertinent to the diffusion flame C
- C model. C
- C C
- C======================================================================C
- include 'UIFlow.com'
- include 'UIFlow.indx'
- C
- C.... Properties for a LAMINAR reacting flow assuming a mixing limited
- C reaction.
- C
- call scalar (igrl, 8, f)
- C
- relxm = 1.0 - relx(5)
- rwmfu = 1.0 / wmfu
- rwmair = 1.0 / wmair
- rwmpr = 1.0 / wmpr
- C
- do 11 j = 2, jmax1
- ioff = (j-1) * imaxl + ibeg
- do 10 i = 2, imax1
- ij = i + ioff
- phi = f(ij) * phifma + phia
- yfu (ij) = amax1( 0.0, phi )
- yo2 (ij) = ( yfu(ij) - phi ) * stoic
- yco2 (ij) = 1.0 - yfu(ij) - yo2(ij)
- h (ij) = f(ij) * enthfu + (1.0 - f(ij)) * enthox
- cpf = acpfu + bcpfu * t(ij) + ccpfu * t(ij) * t(ij)
- cpa = acpair + bcpair * t(ij) + ccpair * t(ij) * t(ij)
- cprd = acpprd + bcpprd * t(ij) + ccpprd * t(ij) * t(ij)
- cph (ij) = yfu(ij) * cpf + yo2(ij) * cpa
- 1 + yco2(ij) * cprd
- tl = ( h(ij) - yfu(ij) * hreact ) / cph(ij)
- t(ij) = relx(5) * tl + relxm * t(ij)
- rwmol = yfu(ij)*rwmfu + yo2(ij)*rwmair + yco2(ij)*rwmpr
- wmol(ij) = 1.0 / rwmol
- 10 continue
- 11 continue
- call dens (igrl)
- C
- if (klam .eq. 0) then
- C
- C.... Properties for a TURBULENT reacting flow assuming a mixing
- C limited reaction.
- C
- call scalar (igrl, 10, g)
- C
- relxmr = 1.0 - relx(11)
- relxmt = 1.0 - relx(5)
- stcp1 = 1.0 + stoic
- C
- do 31 j = 2, jmax1
- ioff = (j-1) * imaxl + ibeg
- do 30 i = 2, imax1
- ij = i + ioff
- fprme = sqrt( g(ij) )
- zsubs = abs( fstoic - f(ij) ) / fprme
- unmxd = 0.45 * exp ( - zsubs )
- unprd = ysub * fprme * unmxd
- yco2(ij) = yco2(ij) - stcp1 * unprd
- if ( yco2(ij) .lt. 0 ) then
- unmxd = 0.5 * unmxd
- unprd = 0.5 * unprd
- endif
- yfu(ij) = yfu(ij) + unprd
- yo2(ij) = yo2(ij) + stoic * unprd
- yco2(ij) = 1.0 - yfu(ij) - yo2(ij)
- tl = t(ij) - tprd * fprme * unmxd
- t(ij) = relx(5) * tl + relxmt * t(ij)
- rrho = 1.0 / rho(ij) - rprd * fprme * unmxd
- rhl = 1.0 / rrho
- rho(ij) = relx(11) * rhl + relxmr * rho(ij)
- rwmol = yfu(ij)*rwmfu + yo2(ij)*rwmair + yco2(ij)*rwmpr
- wmol(ij) = 1.0 / rwmol
- 30 continue
- 31 continue
- endif
- C
- return
- end
- C======================================================================C
- subroutine ftout(i jfl = jfxp(n,igrl)
- jll = jlxp(n,igrl)
- call wallg (igrl,i,i,jfl,jll,1,xxic)
- 20 continue
- C
- j = 2
- do 30 n = 1, nsym
- if ( kbym(n) .ne. 1 ) goto 30
- ifl = ifym(n,igrl)
- ill = ilym(n,igrl)
- call wallg (igrl,ifl,ill,j,j,-imaxl,yetac)
- 30 continue
- C
- j = jmax1
- do 40 n = 1, nsyp
- if ( kbyp(n) .ne. 1 ) goto 40
- ifl = ifyp(n,igrl)
- ill = ilyp(n,igrl)
- call wallg (igrl,ifl,ill,j,j,imaxl,yetac)
- 40 continue
- C
- return
- end
- C======================================================================C
- subroutine geomc1 (igrl)
- C C
- C Purpose: Calculate geometry terms associated with the C
- C transformation to general curvilinear coordinates. C
- C Geometry terms stored at cell centers are C
- C calculated here. C
- C C
- C======================================================================C
- include 'UIFlow.com'
- include 'UIFlow.indx'
- C
- do 11 j = 2, jmax1
- ioff = (j-1) * imaxl + ibeg
- ioff1 = ioff - imaxl
- do 10 i = 2, imax1
- ij = i + ioff
- ij1 = i + ioff1
- xzi = 0.5 * ( x(ij) + x(ij1) - x(ij-1) - x(ij1-1) )
- yzi = 0.5 * ( y(ij) + y(ij1) - y(ij-1) - y(ij1-1) )
- xeta = 0.5 * ( x(ij) + x(ij-1) - x(ij1) - x(ij1-1) )
- yeta = 0.5 * ( y(ij) + y(ij-1) - y(ij1) - y(ij1-1) )
- ajb(ij) = xzi * yeta - xeta * yzi
- q12(ij) = - yzi * yeta - xzi * xeta
- xxic (ij) = sqrt( xzi * xzi + yzi * yzi )
- yetac(ij) = sqrt( yeta * yeta + xeta * xeta )
- dux(ij) = yeta
- duy(ij) = - yzi
- dvx(ij) = - xeta
- dvy(ij) = xzi
- q12(ij) = q12(ij) / ajb(ij)
- q21(ij) = q12(ij)
- 10 continue
- 11 continue
- C
- C.... Change geometry terms if the grid describes an AXISYMMETRIC domain.
- C
- if ( kplax .eq. 1 ) return
- C
- do 21 j = 2, jmax1
- ioff = (j-1) * imaxl + ibeg
- ioff1 = ioff - imaxl
- do 20 i = 2, imax1
- ij = i + ioff
- ij1 = i + ioff1
- rav = 0.25 * ( r(ij) + r(ij-1) + r(ij1) + r(ij1-1) )
- dux(ij) = dux(ij) * rav
- duy(ij) = duy(ij) * rav
- dvx(ij) = dvx(ij) * rav
- dvy(ij) = dvy(ij) * rav
- q12(ij) = q12(ij) * rav
- q21(ij) = q12(ij)
- 20 continue
- 21 continue
- C
- return
- end
- C======================================================================C
- subroutine geomc2 (igrl)
- C C
- C Purpose: Modify the Jacobian for axisymmetric systems. C
- C This modification must NOT be done in Geomc1. C
- C C
- C======================================================================C
- include 'UIFlow.com'
- include 'UIFlow.indx'
- C
- if (kplax .eq. 1) return
- C
- do 11 j = 2, jmax1
- ioff = (j-1) * imaxl + ibeg
- ioff1 = ioff - imaxl
- do 10 i = 2, imax1
- ij = i + ioff
- ij1 = i + ioff1
- rav = 0.25 * ( r(ij) + r(ij-1) + r(ij1) + r(ij1-1) )
- ajb(ij) = ajb(ij) * rav
- 10 continue
- 11 continue
- C
- return
- end
- C======================================================================C
- subroutine geomm
- C C
- C Purpose: Compute all transformation metrics and interpolation C
- C factors. C
- C C
- C======================================================================C
- include 'UIFlow.com'
- C
- do 200 igr = 1,ngrid
- call geomc1 (igr)
- call geomx (igr)
- call geomy (igr)
- call geomc2 (igr)
- call fxx (igr)
- call fyy (igr)
- 200 continue
- C
- return
- end
- C======================================================================C
- subroutine geomx (igrl)
- C C
- C Purpose: Calculate geometry terms associated with the C
- C transformation to general curvilinear coordinates. C
- C Geometry terms stored at cell faces of constant zi C
- C are calculated here. C
- C C
- C======================================================================C
- include 'UIFlow.com'
- include 'UIFlow.indx'
- C
- do 11 j = 2, jmax1
- ioff = (j-1) * imaxl + ibeg
- ioff1 = ioff - imaxl
- do 10 i = 1, imax1
- ij = i + ioff
- ij1 = i + ioff1
- xeta = ( x(ij) - x(ij1) )
- yeta = ( y(ij) - y(ij1) )
- a11(ij) = yeta
- a12(ij) = - xeta
- q11(ij) = a11(ij) * a11(ij) + a12(ij) * a12(ij)
- q11(ij) = 2.0 * q11(ij) / ( ajb(ij) + ajb(ij+1) )
- 10 continue
- 11 continue
- C
- C.... Change geometry terms if the grid describes an AXISYMMETRIC domain.
- C
- if ( kplax .eq. 1 ) return
- C
- do 21 j = 2, jmax1
- ioff = (j-1) * imaxl + ibeg
- ioff1 = ioff - imaxl
- do 20 i = 1, imax1
- ij = i + ioff
- ij1 = i + ioff1
- rav = 0.5 * ( r(ij) + r(ij1) )
- a11(ij) = a11(ij) * rav
- a12(ij) = a12(ij) * rav
- q11(ij) = q11(ij) * rav
- 20 continue
- 21 continue
- C
- return
- end
- C======================================================================C
- subroutine geomy (igrl)
- C C
- C Purpose: Calculate geometry terms associated with the C
- C transformation to general curvilinear coordinates. C
- C Geometry terms stored at cell faces of constant eta C
- C are calculated here. C
- C C
- C======================================================================C
- include 'UIFlow.com'
- include 'UIFlow.indx'
- C
- do 11 j = 1, jmax1
- ioff = (j-1) * imaxl + ibeg
- do 10 i = 2, imax1
- ij = i + ioff
- xzi = ( x(ij) - x(ij-1) )
- yzi = ( y(ij) - y(ij-1) )
- a21(ij) = - yzi
- a22(ij) = xzi
- q22(ij) = a21(ij) * a21(ij) + a22(ij) * a22(ij)
- q22(ij) = 2.0 * q22(ij) / ( ajb(ij) + ajb(ij+imaxl) )
- 10 continue
- 11 continue
- C
- C.... Change geometry terms if the grid describes an AXISYMMETRIC domain.
- C
- if ( kplax .eq. 1 ) return
- C
- do 21 j = 1, jmax1
- ioff = (j-1) * imaxl + ibeg
- do 20 i = 2, imax1
- ij = i + ioff
- rav = 0.5 * ( r(ij) + r(ij-1) )
- a21(ij) = a21(ij) * rav
- a22(ij) = a22(ij) * rav
- q22(ij) = q22(ij) * rav
- 20 continue
- 21 continue
- return
- end
- C======================================================================C
- subroutine grad (igrl,q)
- C C
- C Purpose: Calculate the NEGATIVE of the zi and eta gradients C
- C for the given variable. C
- C C
- C======================================================================C
- include 'UIFlow.com'
- dimension q(*)
- include 'UIFlow.indx'
- C
- do 12 j = 2, jmax1
- ioff = (j-1) * imaxl + ibeg
- do 11 i = 2, imax1
- ij = i + ioff
- ij1 = ij - 1
- ijm = ij - imaxl
- dpdx(ij) = fx(ij1) * q(ij) + fx1(ij1) * q(ij1)
- 1 - fx(ij) * q(ij+1) - fx1(ij) * q(ij)
- dpdy(ij) = fy(ijm) * q(ij) + fy1(ijm) * q(ijm)
- 1 - fy1(ij) * q(ij) - fy (ij) * q(ij+imaxl)
- 11 continue
- 12 continue
- C
- return
- end
- C======================================================================C
- subroutine grid
- C C
- C Purpose: Read in the x,y locations of the finest grid and then C
- C calculate the coarser grids. C
- C C
- C======================================================================C
- include 'UIFlow.com'
- C
- imaxl = imax (ngrid)
- jmaxl = jmax (ngrid)
- ibeg = nbeg (ngrid)
- imax1 = imaxl - 1
- jmax1 = jmaxl - 1
- C
- do 10 i = 1, imax1
- do 11 j = 1, jmax1
- ij = i + (j-1) * imaxl + ibeg
- read (11,*) x(ij), y(ij)
- 11 continue
- 10 continue
- C
- do 20 i= 1, imax1
- do 21 j = 1, jmax1
- ij = i + (j-1) * imaxl + ibeg
- r(ij) = y(ij) + rin
- 21 continue
- 20 continue
- C
- C.... Calculate coarse grids based on the user prescribed finest grid.
- C
- ngrid1 = ngrid - 1
- if (ngrid .eq. 1) return
- do 50 n = 1, ngrid1
- nrev = ngrid - n
- imaxc = imax (nrev)
- jmaxc = jmax (nrev)
- imaxf = imax (nrev + 1)
- jmaxf = jmax (nrev + 1)
- imaxc1 = imaxc - 1
- jmaxc1 = jmaxc - 1
- ibegc = nbeg (nrev)
- ibegf = nbeg (nrev + 1)
- do 30 ic = 1, imaxc1
- do 31 jc = 1, jmaxc1
- if = 2 * ic - 1
- jf = 2 * jc - 1
- ijf = if + (jf - 1) * imaxf + ibegf
- ijc = ic + (jc - 1) * imaxc + ibegc
- x(ijc) = x(ijf)
- y(ijc) = y(ijf)
- r(ijc) = r(ijf)
- 31 continue
- 30 continue
- 50 continue
- C
- return
- end
- C======================================================================C
- subroutine gridp
- C C
- C Purpose: Read in x,y locations of the finest grid and calculate C
- C the x,y locations for the coarser grids. This routine C
- C is used in conjunction with a grid generated by the C
- C pre-processor. C
- C C
- C======================================================================C
- include 'UIFlow.com'
- C
- imaxl = imax (1)
- jmaxl = jmax (1)
- ibeg = nbeg (1)
- imax1 = imaxl - 1
- jmax1 = jmaxl - 1
- C
- do 10 i = 1, imax1
- do 11 j = 1, jmax1
- ij = i + (j-1) * imaxl + ibeg
- read (11,*) x(ij), y(ij)
- 11 continue
- 10 continue
- C
- do 20 i = 1, imax1
- do 21 j = 1, jmax1
- ij = i + (j-1) * imaxl + ibeg
- r(ij) = y(ij) + rin
- 21 continue
- 20 continue
- C
- C.... Calculate coarse grids based on the user prescribed finest grid.
- C
- if (ngrid .eq. 1) return
- do 50 n = 2, ngrid
- imaxc = imax (n-1)
- jmaxc = jmax (n-1)
- imaxf = imax (n)
- jmaxf = jmax (n)
- imaxc1 = imaxc - 1
- jmaxc1 = jmaxc - 1
- ibegc = nbeg (n-1)
- ibegf = nbeg (n)
- do 30 ic = 1, imaxc1
- do 31 jc = 1, jmaxc1
- if = 2 * ic - 1
- jf = 2 * jc - 1
- ijf = if + (jf - 1) * imaxf + ibegf
- ijc = ic + (jc - 1) * imaxc + ibegc
- C
- x(ijf) = x(ijc)
- y(ijf) = y(ijc)
- r(ijf) = r(ijc)
- C
- x(ijf+1) = 0.5*( x(ijc) + x(ijc+1) )
- y(ijf+1) = 0.5*( y(ijc) + y(ijc+1) )
- r(ijf+1) = 0.5*( r(ijc) + r(ijc+1) )
- C
- x(ijf+imaxf) = 0.5*( x(ijc) + x(ijc+imaxc) )
- y(ijf+imaxf) = 0.5*( y(ijc) + y(ijc+imaxc) )
- r(ijf+imaxf) = 0.5*( r(ijc) + r(ijc+imaxc) )
- C
- x(ijf+imaxf+1) = 0.25*( x(ijc)+x(ijc+1)+x(ijc+imaxc)+
- 1 x(ijc+1+imaxc) )
- y(ijf+imaxf+1) = 0.25*( y(ijc)+y(ijc+1)+y(ijc+imaxc)+
- 1 y(ijc+1+imaxc) )
- r(ijf+imaxf+1) = 0.25*( r(ijc)+r(ijc+1)+r(ijc+imaxc)+
- 1 r(ijc+1+imaxc) )
- 31 continue
- 30 continue
- 50 continue
- C
- return
- end
- C======================================================================C
- subroutine header
- C C
- C Purpose: Print a title for program output. C
- C C
- C======================================================================C
- write(8,*)
- write(8,*) ('*',i = 1,86)
- write(8,*) ('*',i = 1,86)
- do 10 j = 1,22
- write(8,*) '**',(' ',i = 1,82),'**'
- 10 continue
- write(8,*) '**',(' ',i=1,34),'UIFLOW - 2D',(' ',i=1,34),'**'
- write(8,*) '**',(' ',i= 1,82),'**'
- write(8,*) '**',(' ',i=1,35),'VERSION 2.0 ',(' ',i=1,35),'**'
- write(8,*) '**',(' ',i= 1,82),'**'
- write(8,*) '**',(' ',i= 1,82),'**'
- write(8,*) '**',(' ',i= 1,82),'**'
- write(8,*) '**',(' ',i=1,19),'UNIVERSITY of ILLINOIS at
- 1 URBANA - CHAMPAIGN',(' ',i=1,19),'**'
- write(8,*) '**',(' ',i= 1,82),'**'
- write(8,*) '**',(' ',i=1,15),'DEPARTMENT of MECHANICAL and
- 1 INDUSTRIAL ENGINEERING',(' ',i=1,15),'**'
- write(8,*) '**',(' ',i= 1,82),'**'
- write(8,*) '**',(' ',i= 1,82),'**'
- write(8,*) '**',(' ',i=1,29),'CONTACT - Dr. S.P. Vanka',
- 1 (' ',i=1,29),'**'
- write(8,*) '**',(' ',i=1,33),'(217) 244 - 8388',
- 1 (' ',i=1,33),'**'
- do 20 j = 1,23
- write(8,*) '**',(' ',i= 1,82),'**'
- 20 continue
- write(8,*) ('*',i = 1,86)
- write(8,*) ('*',i = 1,86)
- write(8,*)
- return
- end
- C======================================================================C
- subroutine init
- C C
- C Purpose: Specify initial estimate of flowfield variables on C
- C all grids. Also specify inlet conditions on all C
- C grids. C
- C C
- C======================================================================C
- include 'UIFlow.com'
- C
- C.... Specify inlet conditions and initial estimates on the finest grid.
- C
- call intern
- call lbndry
- call rbndry
- call tbndry
- call bbndry
- call mssin
- C
- call cpenth (ngrid)
- call enth (ngrid)
- C
- C.... Restrict flow variables to coarser grids.
- C
- if( ngrid .gt. 1 ) then
- ngrid1 = ngrid - 1
- do 10 nr = 1, ngrid1
- igr = ngrid - nr + 1
- call restv (igr)
- call restfl(igr)
- C
- if (klam .eq. 0) then
- call rests (igr, tke)
- call rests (igr, tde)
- endif
- C
- if (model.gt. 0) then
- call rests (igr, h)
- call rests (igr, t)
- call rests (igr, wmol)
- endif
- C
- if (model .eq. 2) then
- call rests (igr, f)
- call rests (igr, yfu)
- call rests (igr, yo2)
- call rests (igr, yco2)
- call rests (igr, yh2o)
- call rests (igr, yn2)
- endif
- C
- if (model .eq. 3) then
- call rests (igr, f)
- if (klam .eq. 0) call rests (igr, g)
- call rests (igr, yfu)
- call rests (igr, yo2)
- call rests (igr, yco2)
- endif
- C
- call extrpl(igr-1)
- 10 continue
- endif
- return
- end
- C======================================================================C
- subroutine input
- C C
- C Purpose: Read in all data pertinent to describing the flow C
- C to be solved. C
- C C
- C======================================================================C
- include 'UIFlow.com'
- C
- C.... Read general problem data.
- C
- read (5, *) klam , kcomp , kswrl, kpgrid, model
- read (5, *) kfuel, knorth, kplax, kadj
- read (5, *) ngrid, ncelx, ncely
- C
- C.... Read segment data.
- C
- read (5, *) nsxm
- do 10 n = 1,nsxm
- read (5, *) kbxm(n), jfc, jlc
- jfxm (n, ngrid) = jfc + 1
- jlxm (n, ngrid) = jlc + 1
- read (5, *) ubxm(n), vbxm(n) , wbxm(n) , dvar , txm(n)
- read (5, *) rhxm(n), fxm(n) , gxm(n) , tkxm(n), tdxm(n)
- read (5, *) fuxm(n), co2xm(n), h2oxm(n), o2xm(n), wmxm(n)
- 10 continue
- C
- read (5, *) nsxp
- do 20 n = 1,nsxp
- read (5, *) kbxp (n), jfc, jlc
- jfxp (n, ngrid) = jfc + 1
- jlxp (n, ngrid) = jlc + 1
- read (5, *) ubxp(n), vbxp(n) , wbxp(n) , dvar , txp(n)
- read (5, *) rhxp(n), fxp(n) , gxp(n) , tkxp(n), tdxp(n)
- read (5, *) fuxp(n), co2xp(n), h2oxp(n), o2xp(n), wmxp(n)
- 20 continue
- C
- read (5, *) nsym
- do 30 n = 1,nsym
- read (5, *) kbym (n), ifc, ilc
- ifym (n, ngrid) = ifc + 1
- ilym (n, ngrid) = ilc + 1
- read (5, *) ubym(n), vbym(n) , wbym(n) , dvar , tym(n)
- read (5, *) rhym(n), fym(n) , gym(n) , tkym(n), tdym(n)
- read (5, *) fuym(n), co2ym(n), h2oym(n), o2ym(n), wmym(n)
- 30 continue
- C
- read (5, *) nsyp
- do 40 n = 1,nsyp
- read (5, *) kbyp(n), ifc, ilc
- ifyp (n, ngrid) = ifc + 1
- ilyp (n, ngrid) = ilc + 1
- read (5, *) ubyp(n), vbyp(n) , wbyp(n) , dvar , typ(n)
- read (5, *) rhyp(n), fyp(n) , gyp(n) , tkyp(n), tdyp(n)
- read (5, *) fuyp(n), co2yp(n), h2oyp(n), o2yp(n), wmyp(n)
- 40 continue
- C
- read (5, *) ugs, vgs, wgs, rhgs
- read (5, *) tgs, tkgs, tdgs, fgs, ggs, fugs
- read (5, *) tfuel, tair
- read (5, *) (prl(nv) , nv=1, 11)
- read (5, *) (prt(nv) , nv=1, 11)
- read (5, *) (relx(nv) , nv=1, 11)
- read (5, *) (nswp(nv) , nv=1, 11)
- read (5, *) (iprint(i), i=1 , 12)
- read (5, *) pref, vscty
- read (5, *) maxitn, tolr(ngrid)
- read (5, *) rin
- read (5, *) nxbaf, nybaf, nobs
- relx(2) = relx(1)
- C
- C call xwcommon
- 1001 format (80a1)
- C
- return
- end
- C======================================================================C
- subroutine intern
- C C
- C Purpose: Initialize internal values of flow variables. C
- C C
- C======================================================================C
- include 'UIFlow.com'
- igrl = ngrid
- include 'UIFlow.indx'
- C
- if(model .gt. 0) rhgs = pref * wmair / ( gascon * tgs )
- C
- do 11 i = 2, imax1
- do 10 j = 2, jmax1
- ijf = i + (j-1) * imaxl + ibeg
- u(ijf) = ugs
- v(ijf) = vgs
- w(ijf) = wgs
- p(ijf) = 0.0
- t(ijf) = tgs
- gam(ijf) = vscty
- amu(ijf) = vscty
- amut(ijf) = cd * rhgs * tkgs * tkgs / ( tdgs + 1.0e-30 )
- rho(ijf) = rhgs
- tke(ijf) = tkgs
- tde(ijf) = tdgs
- f (ijf) = fgs
- g (ijf) = ggs
- yfu(ijf) = fugs
- yco2(ijf) = co2gs
- yh2o(ijf) = h2ogs
- yo2(ijf) = o2gs
- yn2(ijf) = 1.0 - fugs - co2gs - h2ogs - o2gs
- wmol(ijf) = wmair
- cu(ijf) = a11(ijf) * u(ijf) + a12(ijf) * v(ijf)
- cv(ijf) = a21(ijf) * u(ijf) + a22(ijf) * v(ijf)
- cx(ijf) = rho(ijf) * cu(ijf)
- cy(ijf) = rho(ijf) * cv(ijf)
- 10 continue
- 11 continue
- C
- return
- end
- C======================================================================C
- subroutine lamvis (igrl)
- C C
- C Purpose: Compute the laminar viscosity based on the C
- C Sutherland's law constants for AIR only. C
- C C
- C======================================================================C
- include 'UIFlow.com'
- include 'UIFlow.indx'
- C
- do 11 j = 2, jmax1
- ioff = (j-1) * imaxl + ibeg
- do 10 i = 2, imax1
- ij = i + ioff
- amu(ij) = airv * ( t(ij) / airt ) ** 1.5 * ( airsum ) /
- 1 ( t(ij) + airs )
- 10 continue
- 11 continue
- C
- return
- end
- C======================================================================C
- subroutine lbndry
- C C
- C Purpose: Prescribe boundary conditions at the zi-minus (left) C
- C boundary of the calculation domain. C
- C C
- C======================================================================C
- include 'UIFlow.com'
- igrl = ngrid
- include 'UIFlow.indx'
- C
- i = 1
- do 11 n = 1, nsxm
- C
- wmxm(n) = wmair
- if (model .eq. 0) rhxm(n) = rhgs
- if (model .eq. 1) rhxm(n) = pref * wmair / ( gascon * txm(n) )
- if (model .eq. 2) then
- yn2xm = 1.0 - fuxm(n) - o2xm(n) - h2oxm(n) - co2xm(n)
- rwmxm = fuxm(n) / wmfu + o2xm(n) / wmox + yn2xm / wmn2
- 1 + co2xm(n) / wmco2 + h2oxm(n) / wmh2o
- wmxm(n) = 1.0 / rwmxm
- rhxm(n) = pref * wmxm(n) / (gascon * txm(n) + 1.0e-30)
- endif
- C
- jfl = jfxm(n,ngrid)
- jll = jlxm(n,ngrid)
- do 10 j = jfl,jll
- ijf = i + (j-1) * imaxl + ibeg
- rav = 0.5 * ( r(ijf) + r(ijf-imaxl) )
- u (ijf) = ubxm(n)
- v (ijf) = vbxm(n)
- w (ijf) = wbxm(n)
- p (ijf) = 0.0
- t (ijf) = txm (n)
- tke (ijf) = tkxm(n)
- tde (ijf) = tdxm(n)
- f (ijf) = fxm(n)
- g (ijf) = gxm(n)
- yfu (ijf) = fuxm(n)
- yo2 (ijf) = o2xm(n)
- yh2o(ijf) = h2oxm(n)
- yco2(ijf) = co2xm(n)
- yn2 (ijf) = yn2xm
- gam (ijf) = vscty
- amu (ijf) = vscty
- amut(ijf) = cd * rhxm(n) * tkxm(n) * tkxm(n)
- 1 / ( tdxm(n) + 1.0e-30 )
- wmol(ijf) = wmxm(n)
- rho (ijf) = rhxm(n)
- cu (ijf) = a11(ijf)*u(ijf) + a12(ijf)*v(ijf)
- cx (ijf) = cu (ijf)*rho(ijf)
- 10 continue
- 11 continue
- C
- return
- end
- C======================================================================C
- subroutine masfrc (igrl)
- C C
- C Purpose: Calculate the mass fractions of species based on law C
- C of conservation of atoms. C
- C C
- C======================================================================C
- include 'UIFlow.com'
- include 'UIFlow.indx'
- C
- rwmfu = 1.0 / wmfu
- rwmox = 1.0 / wmox
- rwmco2 = 1.0 / wmco2
- rwmh2o = 1.0 / wmh2o
- rwmn2 = 1.0 / wmn2
- C
- do 11 j = 2, jmax1
- ioff = (j-1) * imaxl + ibeg
- do 10 i = 2, imax1
- ij = i + ioff
- fmyfu = f(ij) - yfu(ij)
- yo2(ij) = rox * ( 1.0 - f(ij) ) - rat(3) * fmyfu
- yco2(ij) = rat(1) * fmyfu
- yh2o(ij) = rat(2) * fmyfu
- yo2(ij) = amax1 ( yo2(ij) , 1.0e-20 )
- yco2(ij) = amax1 ( yco2(ij), 0.0 )
- yh2o(ij) = amax1 ( yh2o(ij), 0.0 )
- yn2(ij) = 1.0 - yfu(ij) - yo2(ij) - yco2(ij) - yh2o(ij)
- rwmol = yfu(ij) * rwmfu + yo2(ij) * rwmox
- 1 + yco2(ij) * rwmco2 + yh2o(ij) * rwmh2o
- 2 + yn2(ij) * rwmn2
- wmol(ij) = 1.0 / rwmol
- 10 continue
- 11 continue
- C
- return
- end
- C======================================================================C
- subroutine moment (igrf)
- C C
- C Purpose: Perform multi-grid V cycle on continuity and C
- C momentum equations. C
- C